package com.demo.component;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * Created by IntelliJ IDEA.
 * User: zm
 * Date: 2023/2/26
 */
@Component
public class BeanLifeComponent {
    @PostConstruct
    public void postConstruct() {
        System.out.println("执⾏ PostConstruct()");
    }
    public void init() {
        System.out.println("执⾏ BeanLifeComponent init-method");
    }
    @PreDestroy
    public void preDestroy() {
        System.out.println("执⾏：preDestroy()");
    }
    public void setBeanName(String s) {
        System.out.println("执⾏了 setBeanName ⽅法：" + s);
    }
}
